﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Purdue.Infrastructure;
using Purdue.Enums;
using System.Data.Linq.Mapping;

namespace Purdue.Models.UserInformation
{
    [Table(Name="Customers")]
    public partial class CustomerInfo : NotificationObject
    {
        public CustomerInfo() { }

        #region Fields
        private Int64 id;
        private string account;
        private string password;
        private string serviceCode;
        private string agentCode;
        private string corperation;
        private Int64 tradeId = 0;
        private string linkman;
        private string mobile;
        private string phone;
        private string email;
        private DateTime birthday = DateTime.Now.Date;
        private string province;
        private string city;
        private string address;
        private string postcode;
        private string signature;
        private Int64 balance = 0;
        private Int64 totalCharge = 0;
        private Int64 totalSpend = 0;
        private bool subaccount = false;
        private BillingKindValue billingKind = BillingKindValue.Submit;
        private CustomerStatusValue status = CustomerStatusValue.Moderated;
        private DateTime registerTime = DateTime.Now;
        private DateTime? lastLogin;
        #endregion

        #region Properties
        /// <summary>
        /// 编号
        /// </summary>
        [Column(Name = "Id", IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true, DbType = "BIGINT NOT NULL Identity", AutoSync = AutoSync.OnInsert)]
        public Int64 Id
        {
            get { return id; }
            set
            {
                id = value;
                RaisePropertyChanged(() => Id);
            }
        }

        /// <summary>
        /// 用户名
        /// </summary>
        [Column]
        public string Account
        {
            get { return account; }
            set
            {
                account = value;
                RaisePropertyChanged(() => Account);
            }
        }

        /// <summary>
        /// 登录密码
        /// </summary>
        [Column]
        public string Password
        {
            get { return password; }
            set
            {
                password = value;
                RaisePropertyChanged(() => Password);
            }
        }

        /// <summary>
        /// 特服号
        /// </summary>
        [Column]
        public string ServiceCode
        {
            get { return serviceCode; }
            set
            {
                serviceCode = value;
                RaisePropertyChanged(() => ServiceCode);
            }
        }

        /// <summary>
        /// 代理商
        /// </summary>
        [Column]
        public string AgentCode
        {
            get { return agentCode; }
            set
            {
                agentCode = value;
                RaisePropertyChanged(() => AgentCode);
            }
        }

        /// <summary>
        /// 企业名称
        /// </summary>
        [Column]
        public string Corperation
        {
            get { return corperation; }
            set
            {
                corperation = value;
                RaisePropertyChanged(() => Corperation);
            }
        }

        /// <summary>
        /// 所属行业
        /// </summary>
        [Column]
        public Int64 TradeId
        {
            get { return tradeId; }
            set
            {
                tradeId = value;
                RaisePropertyChanged(() => TradeId);
            }
        }

        /// <summary>
        /// 联系人
        /// </summary>
        [Column]
        public string Linkman
        {
            get { return linkman; }
            set
            {
                linkman = value;
                RaisePropertyChanged(() => Linkman);
            }
        }

        /// <summary>
        /// 手机号码
        /// </summary>
        [Column]
        public string Mobile
        {
            get { return mobile; }
            set
            {
                mobile = value;
                RaisePropertyChanged(() => Mobile);
            }
        }

        /// <summary>
        /// 联系电话
        /// </summary>
        [Column]
        public string Phone
        {
            get { return phone; }
            set
            {
                phone = value;
                RaisePropertyChanged(() => Phone);
            }
        }

        /// <summary>
        /// 电子邮件
        /// </summary>
        [Column]
        public string Email
        {
            get { return email; }
            set
            {
                email = value;
                RaisePropertyChanged(() => Email);
            }
        }

        /// <summary>
        /// 生日
        /// </summary>
        [Column]
        public DateTime Birthday
        {
            get { return birthday; }
            set
            {
                birthday = value;
                RaisePropertyChanged(() => Birthday);
            }
        }

        /// <summary>
        /// 省份
        /// </summary>
        [Column]
        public string Province
        {
            get { return province; }
            set
            {
                province = value;
                RaisePropertyChanged(() => Province);
            }
        }

        /// <summary>
        /// 城市
        /// </summary>
        [Column]
        public string City
        {
            get { return city; }
            set
            {
                city = value;
                RaisePropertyChanged(() => City);
            }
        }

        /// <summary>
        /// 地址
        /// </summary>
        [Column]
        public string Address
        {
            get { return address; }
            set
            {
                address = value;
                RaisePropertyChanged(() => Address);
            }
        }

        /// <summary>
        /// 邮编
        /// </summary>
        [Column]
        public string Postcode
        {
            get { return postcode; }
            set
            {
                postcode = value;
                RaisePropertyChanged(() => Postcode);
            }
        }

        /// <summary>
        /// 签名
        /// </summary>
        [Column]
        public string Signature
        {
            get { return signature; }
            set
            {
                signature = value;
                RaisePropertyChanged(() => Signature);
            }
        }

        /// <summary>
        /// 账户余额
        /// </summary>
        [Column]
        public Int64 Balance
        {
            get { return balance; }
            set
            {
                balance = value;
                RaisePropertyChanged(() => Balance);
            }
        }

        /// <summary>
        /// 累计充值
        /// </summary>
        [Column]
        public Int64 TotalCharge
        {
            get { return totalCharge; }
            set
            {
                totalCharge = value;
                RaisePropertyChanged(() => TotalCharge);
            }
        }

        /// <summary>
        /// 累计消费
        /// </summary>
        [Column]
        public Int64 TotalSpend
        {
            get { return totalSpend; }
            set
            {
                totalSpend = value;
                RaisePropertyChanged(() => TotalSpend);
            }
        }

        /// <summary>
        /// 子账号权限
        /// </summary>
        [Column]
        public bool Subaccount
        {
            get { return subaccount; }
            set
            {
                subaccount = value;
                RaisePropertyChanged(() => Subaccount);
            }
        }

        /// <summary>
        /// 计费方式
        /// </summary>
        [Column(Name = "BillingKind", DbType = "BITINT NOT NULL")]
        public BillingKindValue BillingKind
        {
            get { return billingKind; }
            set
            {
                billingKind = value;
                RaisePropertyChanged(() => BillingKind);
            }
        }

        /// <summary>
        /// 客户账号状态
        /// </summary>
        [Column(Name="Status", DbType="BITINT NOT NULL")]
        public CustomerStatusValue Status
        {
            get { return status; }
            set
            {
                status = value;
                RaisePropertyChanged(() => Status);
            }
        }

        /// <summary>
        /// 注册时间
        /// </summary>
        [Column]
        public DateTime RegisterTime
        {
            get { return registerTime; }
            set
            {
                registerTime = value;
                RaisePropertyChanged(() => RegisterTime);
            }
        }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        [Column]
        public DateTime? LastLogin
        {
            get { return lastLogin; }
            set
            {
                lastLogin = value;
                RaisePropertyChanged(() => LastLogin);
            }
        } 
        #endregion
    }
}
